/**
 * Site
 *
 */

.site {
	box-sizing: border-box;
	display: flex;
	flex: 1 0 auto;
	justify-content: space-between;
	padding: 0;
	position: relative;

	&.is-loading {
		pointer-events: none;

		.site-icon {
			animation: pulse-light 0.8s ease-in-out infinite;
		}

		.site__title,
		.site__domain {
			animation: pulse-light 0.8s ease-in-out infinite;
			background-color: var( --color-neutral-0 );
			color: transparent;
			width: 95%;

			&::after {
				display: none;
			}
		}

		.notouch .sites-popover &:hover {
			.site__title,
			.site__domain {
				color: transparent;
			}
		}
	}

	&.is-compact {
		.site-icon {
			align-self: center;
		}

		.site__content {
			padding: 0 16px;
		}

		.site__domain {
			display: none;
		}

		.site__title {
			line-height: 46px;
		}

		.site__home {
			top: 11px;
			line-height: 18px;
			width: 24px;
			height: 24px;
		}

		.site__home .gridicon {
			margin-top: 0;
		}
	}
}

// Wraps the anchor element
.site__content {
	display: flex;
	justify-content: space-between;
	overflow: hidden;
	padding: 16px;
	position: relative;
	width: 100%;

	.accessible-focus &:focus {
		outline: none;
		box-shadow: inset 0 0 0 2px var( --color-primary-light );

		// Temporarily hides fade out effect on right
		// which is there for extra long domains and titles
		// Else the focus box-shadow is only partially shown
		.site__domain::after,
		.site__title::after {
			display: none;
		}
	}
}

// Adjusts the SiteIcon component for use
// within a Site item
.site .site-icon {
	position: relative;
	height: 30px;
	width: 30px;
	overflow: hidden;
	align-self: flex-start;
	margin-right: 8px;
	flex: 0 0 auto;
}

// The group of site title and domain
.site__info {
	width: 0; // Firefox needs explicit width (even 0)
	flex: 1 0 auto;
}

.site__title {
	color: var( --color-text );
	display: block;
	font-size: $font-body-small;
	font-weight: 400;
	line-height: 1.3;
}

.site__domain {
	color: var( --color-text-subtle );
	display: block;
	max-width: 95%;
	font-size: $font-body-extra-small;
	line-height: 1.4;
	margin-top: 2px;
}

.site__title,
.site__domain {
	overflow: hidden;
	white-space: nowrap;

	&::after {
		@include long-content-fade( $color: var( --color-surface-rgb ) );
	}
}

.site__home {
	background: var( --color-sidebar-menu-selected-background );
	color: var( --color-sidebar-menu-selected-text );
	display: block;
	width: 32px;
	height: 32px;
	text-align: center;
	text-transform: none;
	overflow: initial;
	opacity: 0;
	transition: opacity 0.2s;
	transform: translate3d( 0, 0, 0 );
	position: absolute;
	left: 16px;
	top: 16px;

	.gridicon {
		margin-top: 5px;
		vertical-align: middle;
	}

	@include breakpoint-deprecated( '<660px' ) {
		display: none;
	}
}

.site__content:hover .site__home {
	opacity: 1;
}

.site__badge {
	background: var( --color-sidebar-menu-hover-background );
	color: var( --color-sidebar-menu-hover-text );
	font-size: $font-body-extra-small;
	border-radius: 12px;
	clear: both;
	display: inline-block;
	margin-top: 6px;
	margin-right: 3px;
	padding: 1px 10px;
}

.notouch .site-selector.is-hover-enabled .site:hover .site__badge {
	background: var( --color-sidebar-background );
	color: var( --color-sidebar-text );
}

.current-site .site:hover .site__badge,
.purchases-site .site:hover .site__badge {
	background: var( --color-sidebar-menu-hover-background );
	color: var( --color-sidebar-menu-hover-text );
}
